package com.amigo.online.provider;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

import com.amigo.online.provider.adv.interceptor.LoggerInterceptor;
import com.amigo.online.provider.adv.interceptor.TokenIgnoreInterceptor;
import com.amigo.online.provider.adv.interceptor.TokenInterceptor;


@Configuration
public class AmigoOnlineProviderAdvAuthConfiguration extends WebMvcConfigurationSupport {
    @Bean
    public TokenInterceptor getTokenInterceptor() {
        return new TokenInterceptor();
    }

    @Bean
    public TokenIgnoreInterceptor getTokenIgnoreInterceptor() {
        return new TokenIgnoreInterceptor();
    }

    @Bean
    public LoggerInterceptor getLoggerInterceptor() {
        return new LoggerInterceptor();
    }

    @Override
    protected void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(getLoggerInterceptor()).addPathPatterns("/**");
        //registry.addInterceptor(getTokenInterceptor()).addPathPatterns("/**").excludePathPatterns(patterns);
        //registry.addInterceptor(getTokenIgnoreInterceptor()).addPathPatterns(patterns);
    }

}
